package rmi;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.Observable;
import java.util.Observer;

public class WrappedObserver implements Observer, Serializable {
	private static final long serialVersionUID = 1L;

    private RemoteObserver remoteObserver = null;

    public WrappedObserver(RemoteObserver remoteObserver) {
        this.remoteObserver = remoteObserver;
    }

    @Override
    public void update(Observable observable, Object arg) {
        try {
        	this.remoteObserver.update(observable, arg);
        } catch (RemoteException e) {
            System.out
                    .println("Remote exception removing observer:" + this);
            observable.deleteObserver(this);
        }
    }

}
